package com.cd.controller;

import com.cd.common.controller.BaseController;
import com.cd.common.domain.AjaxResult;
import com.cd.system.service.GanttService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description 甘特图controller
 * @Author lqq
 * @Date 2024/7/12 14:44
 **/
@RestController
@RequestMapping("/business/gantt")
public class GanttController extends BaseController {

    @Autowired
    GanttService ganttService;

    @RequestMapping(value = "/getGanttData",method = RequestMethod.POST)
    public AjaxResult getGanttData(){
        //return ganttService.getGanttData();
//        {
//            id: 1, text: "合同签订", start_date: "2021-01-01", duration: 1345, order: 10,
//                progress: 0.4, open: true
//        },
//        {
//            id: 11, text: "第一次付款", start_date: "2021-03-01", duration: 45, order: 10,
//                progress: 0.6, parent: 1
//        },
//        GanttData ganttData = new GanttData(1, "合同签订", "2021-01-01", "1345", 10, "0.4", true,0);
//        GanttData ganttData1 = new GanttData(11, "第一次付款", "2021-03-01", "45", 10, "0.6", false, 1);
//        List list=new LinkedList();
//        list.add(ganttData);
//        list.add(ganttData1);
        Map<String,Object> map=new HashMap<>();
        map.put("data",ganttService.getGanttData());
        map.put("Link",new ArrayList<>());
        return AjaxResult.success(map);
    }
}
